import { ApiCall } from "tsrpc";
import { ReqNameEmail, ResNameEmail } from "../../shared/protocols/Login/PtlNameEmail";
import { Global } from '../../Global/index';

export default async function (call: ApiCall<ReqNameEmail, ResNameEmail>) {
    // TODO
    const user = await Global.collection('users').findOne({
        name:call.req.name,
        email:call.req.email
    })
    if(user === null){
        call.error('用户名或邮箱错误')
    }
    else{
        call.succ({})
    }
}